﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient;

public partial class UserControls_OnlineSurvey : UCBase
{
    public UserControls_OnlineSurvey()
    {
        Name = "在线调查";

    }

    protected void Page_Load(object sender, EventArgs e)
    {
        BindData();       
    }

    private void BindData()
    {
        DataTable dt = new DataTable();
        long ShopID = _Site.ID;

        dt = new DAL.Tables.tbl_Site_OnlineSurvey().Open("", "IsShow=1", "");

        if (dt.Rows.Count > 0)
        {
            dlSelect.DataSource = dt;
            dlSelect.DataBind();

            dl.DataSource = dt;
            dl.DataBind();
        }

    }

    protected void imgOK_Click(object sender, ImageClickEventArgs e)
    {
        for (int i = 0; i < dlSelect.Items.Count; i++)
        {
            CheckBox cbSelect = (CheckBox)dlSelect.Items[i].FindControl("cbSelect");
            TextBox tbID = (TextBox)dlSelect.Items[i].FindControl("tbID");

            bool a = cbSelect.Checked;
            long ID = Shove._Convert.StrToLong(tbID.Text.Trim(), 0);

            if (cbSelect.Checked)//该行否已选
            {
                Shove.Database.MSSQL.ExecuteNonQuery("update tbl_Site_OnlineSurvey set Amount = Amount + 1 where ID = " + ID);                
               
                  
                    this.BindData();
                
            } 
            Shove._Web.JavaScript.Alert(this.Page,"感谢参与！");
        }


    }
}
